#ifndef PICANIMATIONWID_H
#define PICANIMATIONWID_H

#include <QTimer>
#include <QTreeWidgetItem>
#include <QWidget>
#include <QPixmap>
#include <QMap>
class PicAnimationWid : public QWidget
{
    Q_OBJECT
public:
    explicit PicAnimationWid(QWidget *parent = nullptr);
    ~PicAnimationWid();
    void Start();
    void Stop();
    void SetPixmap(QTreeWidgetItem *item);//设置当前渐隐的图片。
    void SlideNext();
    void SlidePre();
public slots:
    void SlotUpSelectShow(QString path);
    void SlotChange();
signals:
    void SigUpPreList(QTreeWidgetItem *);
    void SigSelectItem(QTreeWidgetItem *);
    void SigStart();
    void SigStartMusic();
    void SigStop();
    void SigStopMusic();
protected:
    //update函数是基类的刷新函数，会触发paintEvent函数
    virtual void paintEvent(QPaintEvent *event)override;
private slots:
    void TimeOut();//定时器触发的槽函数。
private:
    QTimer * _timer;
    QTreeWidgetItem * _cur_item;
    bool _b_start;
    float _factor;//变化的程度
    QPixmap _pixmap1;//渐隐
    QPixmap _pixmap2;//渐显
    QMap<QString , QTreeWidgetItem*> _map_items;
    void UpSelectPixmap(QTreeWidgetItem *item);
};

#endif // PICANIMATIONWID_H
